package org.goyo.main.domain.entity.base;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.goyo.main.domain.entity.BaseObject;
import org.hibernate.annotations.Type;
/**
 * 商品
 * 
 * @author chenchuan
 * 2014年11月5日
 */
@Entity
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"number"})})
public class Material extends BaseObject  implements Serializable {

	private static final long serialVersionUID = 1L;
	//单据编号前缀
	public static final String BIZTYPE = "SP";

	/**
	 * 类型
	 */
	public static final String TYPE = "MATERIAL";
	
	
	/**
	 * 商品条码
	 */
	@Column
	private String barCode;
	
	/**
	 * 规格型号	
	 */
	@Column
	private String standard;
	/**
	 * 商品分类	
	 */
	@ManyToOne
    @JoinColumn(name="matCategoryId")
	private Categories matCategory;
	/**
	 * 计量单位	
	 */
	@ManyToOne
    @JoinColumn(name="baseUnitId")
	private BaseUnitMeasure baseUnit;
	
	/**
	 * 安全库存
	 */
	@Column
	private String safeStock;
	
	/**
	 * 最小采购量
	 */
	@Column
	private String minPurchaseAmount;
	
	   /**
     * 商品图片 
     */
    @Column
    private String matPicture;
    
    /**
     * 批次管理 
     */
    @Column
    @Type(type="boolean")
    private Boolean lotManage;
    /**
     * 条码管理 
     */
    @Column
    @Type(type="boolean")
    private Boolean barCodeManage;
    /**
     * 序列号管理    
     */
    @Column
    @Type(type="boolean")
    private Boolean sequeManage;
    /**
     * 保质期管理    
     */
    @Column
    @Type(type="boolean")
    private Boolean expiraDateManage;
    
    /**
     * 保质期  
     */
    @Column
    private String expiraData;
    /**
     * 保质期单位    
     */
    @Column
    private String expiraDataUtil;
    public String getBarCode() {
      return barCode;
    }
    public void setBarCode(String barCode) {
      this.barCode = barCode;
    }
    public String getStandard() {
      return standard;
    }
    public void setStandard(String standard) {
      this.standard = standard;
    }
    public Categories getMatCategory() {
      return matCategory;
    }
    public void setMatCategory(Categories matCategory) {
      if(matCategory != null &&("".equals(matCategory.getUuid()) || matCategory.getUuid()==null))
        this.matCategory = null;
    else
        this.matCategory = matCategory; 
    }
    public BaseUnitMeasure getBaseUnit() {
      return baseUnit;
    }
    public void setBaseUnit(BaseUnitMeasure baseUnit) {
      if(baseUnit != null &&("".equals(baseUnit.getUuid()) || baseUnit.getUuid()==null))
        this.baseUnit = null;
    else
        this.baseUnit = baseUnit;
    }
    public String getSafeStock() {
      return safeStock;
    }
    public void setSafeStock(String safeStock) {
      this.safeStock = safeStock;
    }
    public String getMinPurchaseAmount() {
      return minPurchaseAmount;
    }
    public void setMinPurchaseAmount(String minPurchaseAmount) {
      this.minPurchaseAmount = minPurchaseAmount;
    }
    public String getMatPicture() {
      return matPicture;
    }
    public void setMatPicture(String matPicture) {
      this.matPicture = matPicture;
    }
    public Boolean getLotManage() {
      return lotManage;
    }
    public void setLotManage(Boolean lotManage) {
      this.lotManage = lotManage;
    }
    public Boolean getBarCodeManage() {
      return barCodeManage;
    }
    public void setBarCodeManage(Boolean barCodeManage) {
      this.barCodeManage = barCodeManage;
    }
    public Boolean getSequeManage() {
      return sequeManage;
    }
    public void setSequeManage(Boolean sequeManage) {
      this.sequeManage = sequeManage;
    }
    public Boolean getExpiraDateManage() {
      return expiraDateManage;
    }
    public void setExpiraDateManage(Boolean expiraDateManage) {
      this.expiraDateManage = expiraDateManage;
    }
    public String getExpiraData() {
      return expiraData;
    }
    public void setExpiraData(String expiraData) {
      this.expiraData = expiraData;
    }
    public String getExpiraDataUtil() {
      return expiraDataUtil;
    }
    public void setExpiraDataUtil(String expiraDataUtil) {
      this.expiraDataUtil = expiraDataUtil;
    }

	
	
/*	*//**
	 * 单价精度	
	 *//*
	@Column
	private String pricePrecision;

	
	*//**
	 * 库存数量
	 *//*
	@Column
	private long InventoryQty;
	
	*//**
	 * 是否组合销售
	 *//*
	@Column
	private String  isGroupM;
	
	*//**
	 * 库存资料
	 *//*
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="inventoryId")
	private MaterialInventory inventory;
	
	@OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="parent_id")
    private List<MaterialEntry> entrys = new ArrayList<MaterialEntry>();*/
	
/*	public String getStandard() {
		return standard;
	}
	public void setStandard(String standard) {
		this.standard = standard;
	}
	
	public Categories getMatCategory() {
    return matCategory;
  }
  public void setMatCategory(Categories matCategory) {
	  if(matCategory != null &&("".equals(matCategory.getUuid()) || matCategory.getUuid()==null))
			this.matCategory = null;
		else
			this.matCategory = matCategory;	
  }

	public BaseUnitMeasure getBaseUnit() {
    return baseUnit;
  }
  public void setBaseUnit(BaseUnitMeasure baseUnit) {
	  if(baseUnit != null &&("".equals(baseUnit.getUuid()) || baseUnit.getUuid()==null))
			this.baseUnit = null;
		else
			this.baseUnit = baseUnit;	
  }
  public String getPricePrecision() {
		return pricePrecision;
	}
	public void setPricePrecision(String pricePrecision) {
		this.pricePrecision = pricePrecision;
	}
	public String getMatPicture() {
		return matPicture;
	}
	public void setMatPicture(String matPicture) {
		this.matPicture = matPicture;
	}
	public MaterialInventory getInventory() {
		return inventory;
	}
	public void setInventory(MaterialInventory inventory) {
		if(inventory != null &&("".equals(inventory.getUuid()) || inventory.getUuid()==null))
			this.inventory = null;
		else
			this.inventory = inventory;
	}
  public List<MaterialEntry> getEntrys() {
    return entrys;
  }
  public void setEntrys(List<MaterialEntry> entrys) {
    this.entrys = entrys;
  }
	public long getInventoryQty() {
		return InventoryQty;
	}
	public void setInventoryQty(long inventoryQty) {
		InventoryQty = inventoryQty;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getIsGroupM() {
		return isGroupM;
	}
	public void setIsGroupM(String isGroupM) {
		this.isGroupM = isGroupM;
	}*/

}
